import { _decorator, BoxCollider2D, Collider2D, Component, Contact2DType, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('touch')
export class touch extends Component {
    @property(Node)
    Rope: Node = null;
    start() {
        let BoxCollider = this.node.getComponent(BoxCollider2D)
        // 注册碰撞回调
        BoxCollider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
    }
    //  contact: Collider2D, selfCollider: Collider2D, otherCollider: Collider2D
    onBeginContact() {
        globalThis.touchController.Touch()
        this.node.destroy();
    }

     
}

